package platform.javaobject.client;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import platform.javaobject.codec.ObjDecoder;
import platform.javaobject.codec.ObjEncoder;
import platform.javaobject.domain.MsgInfo;

public class MyChannelInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        // 对象传输处理
        socketChannel.pipeline().addLast(new ObjDecoder(MsgInfo.class));
        socketChannel.pipeline().addLast(new ObjEncoder(MsgInfo.class));
        // 添加管道方法
        socketChannel.pipeline().addLast(new MyClientHandler());
    }
}
